package com.twu.biblioteca.tools;

import com.twu.biblioteca.Library.User;

import java.util.ArrayList;
import java.util.List;

public class UserFactory {

    public static List<User> initUsers() {
        List<User> users = new ArrayList<User>();

        User davide = new User("000-0001", "123456");
        davide.setUserName("Davide");
        davide.setEmail("a@gmail.com");
        davide.setAddress("1 street");
        davide.setPhoneNumber("1234567890");
        users.add(davide);

        User grace = new User("000-0002", "234567");
        grace.setUserName("Grace");
        grace.setEmail("b@gmail.com");
        grace.setAddress("2 street");
        grace.setPhoneNumber("1234567891");
        users.add(grace);

        User kate = new User("000-0003", "345678");
        kate.setUserName("Kate");
        kate.setEmail("c@gmail.com");
        kate.setAddress("3 street");
        kate.setPhoneNumber("1234567892");
        users.add(kate);
        return users;
    }

    public static void checkLogin(User user) throws NullPointerException {
        if (user.getUserId() == null) {
            throw new NullPointerException();
        }
    }
}
